﻿using NPOI.Util;
using OxyPlot;
using OxyPlot.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LongGi.TingkatKebocoranModule.CommModel
{
    public static  class ChartCommon
    {

        public  static (LineAnnotation , PlotModel) SetLineAnnotation(double value, string text, PlotModel pmodel, LineAnnotation oldann)
        {
            if (pmodel==null)
            {
                return (null ,null );
            }
            var model=new PlotModel();


            model = pmodel;
           
           var ann=new LineAnnotation
            {
                Type = LineAnnotationType.Horizontal,
                Y = value, // 上限值
                Color = OxyColors.Red,
                LineStyle = LineStyle.Dash, // 虚线
                Text = text,
                 StrokeThickness = 2
           };
            model.Annotations.Remove(oldann);
            model.Annotations.Add(ann);

            pmodel = model;
            return (ann,model);
        }

    }
}
